﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using FazaDemo.PL.AbstractPresenters;

namespace FazaDemo.PL.Wpf
{
    public class SuppleTabsPresenter : ISuppleTabsPresenter
    {

        private readonly WorkArea _workArea;

        private readonly TabsGenerator _generator;

        private readonly ITabContentFiller _contentFiller;

        public SuppleTabsPresenter(WorkArea workArea)
        {
            _workArea = workArea;
            _generator = new TabsGenerator(_workArea);
            _contentFiller = new SuppleTabContentFiller(workArea);
        }

        public void BuildTabs(IEnumerable<string> headers)
        {
            _generator.Build(headers);
            var tabs = _workArea.TabCtrlSupple.Items.Cast<TabItem>()
                .ToList();
            _contentFiller.Fill(tabs);
        }
    }
}
